package com.tiyende.kash.loop.request

import org.json.JSONObject

/**
 * HttpHelper
 * @Author wwdeng
 * @CreateTime: 2024/11/20 17:38
 * @Annotation：网络请求帮助类
 */
object HttpHelper : IHttpLoader {

    private var mHttpLoader: IHttpLoader? = null

    fun init(httpLoader: IHttpLoader) {
        mHttpLoader = httpLoader
    }

    override fun post(url: String, params: JSONObject, callback: IHttpCallback) {
        mHttpLoader?.post(url, params, callback)
    }

    override fun upload(filePath: String, callback: IHttpCallback) {
        mHttpLoader?.upload(filePath,callback)
    }

    override fun postPoint(url: String, params: JSONObject, callback: IHttpCallback) {
        mHttpLoader?.postPoint(url, params, callback)
    }

    override fun addPoint(eventName: String, remark: String?,callback: IHttpCallback) {
        mHttpLoader?.addPoint(eventName,remark,callback)
    }

    override fun setTag(tag: Any) {
        mHttpLoader?.setTag(tag)
    }

    override fun cancelTag(tag: Any) {
        mHttpLoader?.cancelTag(tag)
    }
}
